package com.mike.client;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

import com.mike.game.protocols.RoleSystenProtocols;
import com.mike.util.IntConverter;

public class GameClient {
	public static void main(String[] args) {
		Socket socket = new Socket();
		try {
			socket.connect(new InetSocketAddress("192.168.1.125", 9123));
			OutputStream outputStream = socket.getOutputStream();
			byte[] bytes = new byte[8];
			
			byte[] byteArray = IntConverter.toByteArray(5);
			byte[] byteArray2 = IntConverter.toByteArray(RoleSystenProtocols.UPDATE_ROLE);
			
			bytes[0] = byteArray[0];
			bytes[1] = byteArray[1];
			bytes[2] = byteArray[2];
			bytes[3] = byteArray[3];
			bytes[4] = byteArray2[0];
			bytes[5] = byteArray2[1];
			bytes[6] = byteArray2[2];
			bytes[7] = byteArray2[3];
			outputStream.write(bytes);
			outputStream.flush();
			outputStream.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
